package cn.com.wangluotongxin.mall.controller;

import cn.com.wangluotongxin.common.constants.CommonConstant;
import cn.com.wangluotongxin.common.web.AjaxResult;
import cn.com.wangluotongxin.mall.model.MallQuickQuery;
import cn.com.wangluotongxin.mall.service.IMallQuickQueryService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 网络通信-商城APP-快捷查询 前端控制器
 * </p>
 *
 * @author AutoGenerator
 * @since 2024-10-21
 */
@Api(tags = "网络通信-商城APP-快捷查询 相关接口")
@RestController
@RequestMapping("/quick/query")
public class MallQuickQueryController {

    @Autowired
    private IMallQuickQueryService quickQueryService;

    @ApiOperation("列表")
    @GetMapping("/list")
    public AjaxResult<List<MallQuickQuery>> list() {
        return AjaxResult.success(quickQueryService.list(new LambdaQueryWrapper<MallQuickQuery>()
                .eq(MallQuickQuery::getIsEnabled, CommonConstant.ONE)
                .last("order by quick_sort asc, id desc")));
    }
}